package com.sdx.console.evaluation.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.evaluation.dao.CpTaskRuleDao;
import com.sdx.console.evaluation.entity.CpTaskRule;
import com.ibeetl.admin.core.service.BaseService;

/**
 * CpTaskRule Service
 */

@Service
@Transactional
public class CpTaskRuleService extends BaseService<CpTaskRule>{

    @Resource
	private CpTaskRuleDao cpTaskRuleDao;

    public PageQuery<CpTaskRule>queryByCondition(PageQuery query){
        PageQuery ret =  cpTaskRuleDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelCpTaskRule(List<String> ids){
        try {
            cpTaskRuleDao.batchDelCpTaskRuleByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除CpTaskRule失败", e);
        }
    }



	public List<CpTaskRule> all() {
		return cpTaskRuleDao.all();
		}

    public void delRule(Integer taskId) {
        cpTaskRuleDao.delRule( taskId);
    }
}